<template>
  <div class="itemall">
    <div class="single_select_answer" v-if="form.type == 1">
      <div
        v-for="(item, index) in form.select_options"
        :key="index"
        class="line"
      >
        <el-radio
          v-model="form.single_select_answer"
          @change="change('single_select_answer')"
          :label="item.label"
          >{{ item.label }}</el-radio
        >
        <!-- radio单选框中v-model与label为浏览器读取到的值,二者数据同步,而显示的值为中间的文本内容-->
        <el-input v-model="item.text" class="w500"></el-input>
        <phupload v-model="item.image"></phupload>
      </div>
    </div>
    <div class="multiple_select_answer" v-else-if="form.type == 2">
      <div
        v-for="(item, index) in form.select_options"
        :key="index"
        class="line"
      >
        <el-checkbox
          v-model="form.multiple_select_answer"
          :label="item.label"
          >{{ item.label }}</el-checkbox
        >
        <el-input v-model="item.text" class="w500"></el-input>
        <phupload v-model="item.image"></phupload>
      </div>
    </div>
    <div class="short_answer" v-else>
      <el-input
        type="textarea"
        :rows="5"
        placeholder="请输入内容"
        v-model="from.short_answer"
      ></el-input>
    </div>
  </div>
</template>

<script>
import phupload from "@/components/ph_upload.vue";
export default {
  components: {
    phupload,
  },
  props: ["form"],
  methods: {
    change(msg) {
      this.$emit("quillchange", msg);
    },
  },
};
</script>

<style lang="less">
.itemall {
  .line {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 30px;
    .w500 {
      width: 500px;
      margin-right: 20px;
    }
  }
  .el-checkbox__label {
    margin-right: 30px;
  }
  .single_select_answer {
    display: flex;
    flex-flow: column;
    align-items: flex-start;
  }
}
</style>
